package com.xnyzc.lhy.mis.controller.cmsapi.allocation;

import com.xnyzc.lhy.common.entity.Rv;
import com.xnyzc.lhy.mis.entity.param.cms.OfficeParam;
import com.xnyzc.lhy.mis.service.cms.allocation.AllocationService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 分配相关
 *
 * @Author: wangshuo
 * @Date: 2019-08-23 14:11
 */
@RestController
@RequestMapping("/cmsapi/allocation")
public class AllocationController {

    @Autowired
    private AllocationService allocationService;

    /**
     * 用户、司机机构关联数据
     * @return
     */
    @ApiOperation(value = "用户、司机机构关联数据", notes = "用户、司机机构关联数据")
    @PostMapping(value = "/getUserOfficeAllocationData")
    public Rv getUserOfficeAllocationData(
    ) {
        return Rv.wrap(allocationService.getUserOfficeAllocationData());
    }

    /**
     * 用户关联机构
     * @return
     */
    @ApiOperation(value = "用户关联机构", notes = "用户关联机构")
    @PostMapping(value = "/getUserOfficeAllocation")
    public Rv getUserOfficeAllocation(
            @ApiParam(name = "officeParam", value = "机构请求类") @RequestBody OfficeParam officeParam
    ) {
        return Rv.wrap(allocationService.getUserOfficeAllocation(officeParam));
    }

    /**
     * 司机关联机构
     * @return
     */
    @ApiOperation(value = "司机关联机构", notes = "司机关联机构")
    @PostMapping(value = "/getDriverOfficeAllocation")
    public Rv getDriverOfficeAllocation(
            @ApiParam(name = "officeParam", value = "机构请求类") @RequestBody OfficeParam officeParam
    ) {
        return Rv.wrap(allocationService.getDriverOfficeAllocation(officeParam));
    }

    /**
     * 查询所有司机定位信息
     * @return
     */
    @ApiOperation(value = "司机关联机构", notes = "司机关联机构")
    @PostMapping(value = "/getVehicleGpsList")
    public Rv getVehicleGpsList() {
        return Rv.wrap(allocationService.getVehicleGpsList());
    }
}
